package com.example.administrator.hqq.utils;

import android.annotation.SuppressLint;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @name: HQQ
 * @describe:
 * @author: 康海涛 QQ2541849981
 * @time: 2018/11/25 14:13
 * @remark:
 */
public class TimeUtils {
    private static long dayMs=86400000;
    private static SimpleDateFormat simpleDateFormat=new SimpleDateFormat("HH:mm");
    private static SimpleDateFormat simpleDateFormat1=new SimpleDateFormat("MM-dd");
    private static SimpleDateFormat simpleDateFormat2=new SimpleDateFormat("MM-dd");
    @SuppressLint("SimpleDateFormat")
   public static String getTimeString(long i){
        if (System.currentTimeMillis()-i<86400000) {
            Date date = new Date(i);
            return simpleDateFormat.format(date);
        }
       else{
            Date date = new Date(i);
            return simpleDateFormat1.format(date);
        }
    }
    public static String getTimeStringTwo(long i){
        if (System.currentTimeMillis()-i<86400000) {
            Date date = new Date(i);
            return simpleDateFormat.format(date);
        }
        else{
            Date date = new Date(i);
            return simpleDateFormat2.format(date);
        }
    }
    @SuppressLint("SimpleDateFormat")
    public static String getTimeTypeString(long i, String s){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(s);
        Date date = new Date(i);
        return simpleDateFormat.format(date);
    }
}
